package written.test;

import java.util.Scanner;

/**
 * @Author: Dang Qi
 * @Date: 2021/4/4  10:32
 * @Description:
 */
public class MeiQ3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] arr = new int[n];
        for(int i = 0 ; i < n; i++){
            arr[i] = sc.nextInt();
        }
        System.out.println(cal(arr, k+""));
    }
    public static int cal(int[] arr, String k){
        int ans = 0;
        for(int i = 0; i < arr.length; i++){
            StringBuilder sb = new StringBuilder();
            for(int j = 1; j <= arr[i]; j++){
                if(arr[i] % j == 0){
                    sb.append(j+"");
                }
            }
            if(sb.toString().contains(k))
                ans++;
        }
        return ans;
    }
}
